package top.yudoge.dogeeditor.db.api

enum class TableTypeEnum {
    Table("TABLE"),
    View("VIEW");

    val jdbcCode: String

    constructor(jdbcCode: String) {
        this.jdbcCode = jdbcCode
    }

    companion object {
        fun byJDBCCode(jdbcCode: String): TableTypeEnum? {
            return when (jdbcCode) {
                "TABLE" -> Table
                "VIEW" -> View
                else -> null
            }
        }

        fun allJDBCCode(): Array<String> {
            return values().map { it -> it.jdbcCode }.toTypedArray()
        }
    }

}